﻿<?xml version="1.0" encoding="utf-8"?>
<Mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Entity type="NUnit:DynamicProxy:Person" table="Person" discriminator-field="Type" discriminator-value="NUnit:DynamicProxy:Person">
    <Id field="PersonId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" field="Name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="Age" field="Age" db-type="Int32" size="0" scale="0" precision="0" not-null="false" />
    <Attribute name="Birth" field="Birth" db-type="DateTime" size="0" scale="0" precision="0" not-null="false" />
    <Attribute name="Title" field="Title" db-type="String" size="255" scale="0" precision="0" not-null="false" />
    <Attribute name="Kind" field="Kind" db-type="String" size="0" scale="0" precision="0" not-null="false" />
    <Attribute name="Owner" field="Owner" db-type="Guid" size="36" scale="0" precision="0" not-null="false" />
    <Attribute name="Picture" field="Picture" db-type="Binary" size="0" scale="0" precision="0" not-null="false" />
    <Reference name="Partners" entityChild="NUnit:DynamicProxy:Person">
      <Rule parentField="PersonId" childTable="Person_Partners" childField="FK_ParentId" />
      <Rule parentField="FK_ChildId" childTable="Person" childField="PersonId" />
    </Reference>

    <Reference name="Employees" entityChild="NUnit:DynamicProxy:Employee">
      <Rule parentField="PersonId" childTable="Person_Partners" childField="FK_ParentId" />
      <Rule parentField="FK_ChildId" childTable="Person" childField="PersonId" />
    </Reference>

    <Reference name="Address" entityChild="NUnit:DynamicProxy:Address">
      <Rule parentField="PersonId" childTable="Address" childField="AddressId" />
    </Reference>
  </Entity>

  <Entity type="NUnit:DynamicProxy:Employee" table="Person" discriminator-field="Type" discriminator-value="NUnit:DynamicProxy:Employee">
    <Id field="PersonId">
      <Generator name="guid" />
    </Id>
    
    <Attribute name="Salary" field="Salary" db-type="Double" size="0" scale="0" precision="0" not-null="false" />
    
  </Entity>

  <Entity type="NUnit:DynamicProxy:Address" table="Address">
    <Id field="AddressId">
      <Generator name="guid" />
    </Id>
    <Attribute name="City" table="Address" field="City" db-type="String" size="50" scale="0" precision="0" not-null="false" />

    <Reference name="Country" entityChild="NUnit:DynamicProxy:Country">
      <Rule parentField="AddressId" childTable="Country" childField="CountryId" />
    </Reference>
  </Entity>

  <Entity type="NUnit:DynamicProxy:Country" table="Country">
    <Id field="CountryId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" table="Country" field="Name" db-type="String" size="50" scale="0" precision="0" not-null="false" />

  </Entity>

  <Entity type="NUnit:DynamicProxy:Task" table="Task">
    <Id field="TaskId">
      <Generator name="native" >
        <Property name="dbType">Int32</Property>
      </Generator>
    </Id>
    <Attribute name="Libelle" table="Task" field="Libelle" db-type="String" size="50" scale="0" precision="0" not-null="false" />

  </Entity>
  
</Mapping>